/****************************************************************
 * I am the AC 130 vs Pirate game. I allow the user to control an 
 * AC130 gunship in the hunt for Modern day pirates. The player  
 * will be allowed to roam free across a section of ocean/coastline.  
 * In the water there will be four types of vessels: Merchant  
 * ships that the player must protect, Pirate ships that the player  
 * must identify and destroy, Fishing boats that look like Pirate  
 * ships that the player must not destroy, and Friendly Navy ships  
 * that can capture pirates for extra points. Time permitting there  
 * may also be ground targets to attack. 
 *
 * Key elements of this project will be the Player/AC130, the Ships,  
 * the ShipAI system, the collision grid, the debris controller, the  
 * Ground/Water, Clouds, and scoring system. This project will make  
 * use of an external text file to store useful game parameters,  
 * thus allowing us to play balance the game without recompiling  
 * the executable. 
 *****************************************************************
 * I am the Building controll class. I am the root container for all
 * Building objects. I have functions that Update and render all the 
 * building objects. I have file reading and writing functions that
 * can be used to load and save builging data for the level. I also
 * store pointers to the GameData and BulletCtrl classes internaly.
 *****************************************************************/

#include "Camera.h"
#include "BulletCtrl.h"
#include "Building.h"
#include <allegro.h>

#ifndef __BULDING_CTRL_H__
#define __BULDING_CTRL_H__

#define BUILDINGMAX 256
#define BUILDINGTYPE 64

class BuildingCtrl {
public:
	GameData * gd;
	BulletCtrl * myBulletCtrl;

	Building * myBuilding[BUILDINGMAX];
	int maxIndex;
	int editIndex;

	// type values
	int maxType;
	BITMAP * imgAlive[BUILDINGTYPE];
	BITMAP * imgDead[BUILDINGTYPE];
	float minRad[BUILDINGTYPE];
	int minPeople[BUILDINGTYPE];
	int maxHp[BUILDINGTYPE];
	int loyalty[BUILDINGTYPE];

public:
	BuildingCtrl();
	~BuildingCtrl();

	void Init(GameData *exGd, BulletCtrl * exBulletCtrl);
	void PlaceBldg(Point * center, Point * modifier, int type);

	void LoadBuilding(char* path);
	void SaveBuilding(char* path);

	void Update();
	
	int PickType(int screenX, int screenY);

	void Draw( Camera * cam);
	void DrawTypePick( Camera * cam, int curTile);

};

#endif